package com.tom.architect02.ui10.day07;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.tom.architect02.R;

public class MainActivityUI07 extends AppCompatActivity {
    private TextView mLetterTv;
    private LetterSideBar mLetterSideBar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_ui07);

        mLetterTv = findViewById(R.id.letter_tv);
        mLetterSideBar = findViewById(R.id.letter_side_bar);
        mLetterSideBar.setOnLetterTouchListener(new LetterSideBar.LetterTouchListener() {
            @Override
            public void touch(CharSequence letter, boolean isTouch) {
                if (isTouch) {
                    mLetterTv.setVisibility(View.VISIBLE);
                    mLetterTv.setText(letter);
                } else {
                    mLetterTv.setVisibility(View.GONE);
                }
            }
        });
    }

}